1. Technical Field
The present invention provides apparatus and methods for improved devirtualization of method calls. More specifically, the present invention provides apparatus and methods for performing lookups of appropriate methods to be invoked on objects only when it has been determined that the method has been overridden or overloaded.
2. Description of Related Art
Many Java method calls are virtual. This means that the target method of the site of a call is dependent on the object upon which the method is invoked. This dependency requires a lookup of the appropriate method to be invoked on the object. The lookup takes time and reduces performance. A Java just-in-time compiler can make method calls with less overhead if the method is not overloaded, i.e. if the method does not have an alternative method with the same name and signature, defined in a subclass of the class of the original method, to be used instead of the original method for objects of type of the subclass.
Thus, it would be beneficial to have apparatus and methods for performing a lookup of a method to be invoked which reduces the amount of time used to perform lookups. It would further be beneficial to have an apparatus and method for performing lookups only when they are necessary to finding an appropriate method to be invoked on an object.
Apparatus and methods are provided for improving devirtualization of method calls in Java. The apparatus and methods reduce the amount of processing time used in performing lookups of methods by limiting such lookups to calls of methods that have been either overridden or overloaded. If a method has not been overridden or overloaded, a branch to the compiled method code is directly taken. If a method has been overridden or overloaded, a lookup routine is executed for looking-up the appropriate method to be invoked on the passed object. The identification of whether to use a lookup routine may be performed in many different ways including providing an extra field in a method block of the method, inserting code into a prolog of the method, and the like.